<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="Cache-Control" content="no-cache"/>
    <meta name="Pragma" content="no-cache"/>
    <meta name="Expires" content="0"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <meta name="MobileOptimized" content="320"/>
    <meta name="Author" content="李玉江，QQ:1032694760，EMAIL:liyujiang_tk@yeah.net"/>
    <title>蓝牙热敏纸打印机</title>
    <style type="text/css">
    </style>
</head>
<body>
<div style="padding-top:25px;">
    <button onclick="checkBluetoothEnable()">
        检查蓝牙是否开启:Bluetooth.isBluetoothEnabled();
    </button>
    <br/>
    <button onclick="Bluetooth.enableBluetooth()">
        开启蓝牙:Bluetooth.enableBluetooth();
    </button>
    <br/>
    <button onclick="Bluetooth.disableBluetooth()">
        关闭蓝牙:Bluetooth.disableBluetooth();
    </button>
    <br/>
    <button onclick="Bluetooth.openBluetoothSettings()">
        打开蓝牙设置(配对):Bluetooth.openBluetoothSettings();
    </button>
    <br/>
    <button onclick="Bluetooth.showAlert(Bluetooth.getPairedDevice())">
        获取已配对蓝牙设备:json=Bluetooth.getPairedDevice();
    </button>
    <br/>
    <button onclick="Bluetooth.connectPrinter('DC:0D:30:60:A1:F3')">
        连接蓝牙打印机:Bluetooth.connectPrinter('DC:0D:30:60:A1:F3');
    </button>
    <br/>
    <button onclick="Bluetooth.printPaper('{}')">打印测试:Bluetooth.printPaper(json)</button>
    <br/>
    <button onclick="Bluetooth.disconnectPrinter()">
        断开打印机连接:Bluetooth.disconnectPrinter();
    </button>
    <br/>
</div>
</body>
<script type="text/javascript">
        function checkBluetoothEnable(){
            if (Bluetooth.isBluetoothEnabled()) {
                Bluetooth.showToast('蓝牙已打开');
            } else {
                Bluetooth.showToast('蓝牙未打开');
            }
        }
</script>
</html>
